﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMIS.Entities;
using SMIS.Dals;

namespace SMIS
{
    public partial class ModifyJob : Form
    {
        public int MdfID { get; set; }
        public string MdfName { get; set; }
        public string MdfDes { get; set; }

        public ModifyJob()
        {
            InitializeComponent();
        }

        private void ModifyJob_Load(object sender, EventArgs e)
        {
            txtID.Text = Convert.ToString(MdfID);
            txtName.Text = MdfName;
            txtDes.Text = MdfDes;
        }

        //【高月 2013-3-31-172122】修改工种信息时的确认保存按钮事件,并判断工种名称是否发生重复
        private void button1_Click(object sender, EventArgs e)
        {
            Job job = new Job();
            job.ID = Convert.ToInt16(txtID.Text);
            job.Name = txtName.Text;
            job.Des = txtDes.Text;

            if (Dal4Job.UpdateSelectedJob(job) == true)
            {
                if(MessageBox.Show("确定要修改工种种类信息吗？","确认信息",MessageBoxButtons.OKCancel,
                   MessageBoxIcon.Question)==DialogResult.OK)
                   MessageBox.Show("恭喜您修改工种种类信息成功！","提示");
            }
            else
            {
                MessageBox.Show("工种名称发生重复","提示");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
